<!-- Horizontal Form -->
<div class="box box-info">
	<div class="box-header with-border">
		<h3 class="box-title">修改密码</h3>
	</div>
	<!-- /.box-header -->
	<!-- form start -->
	<form class="form-horizontal">
		<div class="box-body">
		<div class="form-group">
				<label for="nameId" class="col-sm-2 control-label" style=" visibility: hidden;">用户名</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" name="name"
						id="username" placeholder="..." readonly="true" style=" visibility: hidden;">
				</div>
			</div>
			<div class="form-group">
				<label for="nameId" class="col-sm-2 control-label">原密码</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" name="name"
						id="oripassword" placeholder="请输入原来的密码">
				</div>
			</div>
			<div class="form-group">
				<label for="nameId" class="col-sm-2 control-label">新密码</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" name="name"
						id="newpassword1" placeholder="请输入新的密码" >
				</div>
			</div>
			<div class="form-group">
				<label for="nameId" class="col-sm-2 control-label">新密码确认</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" name="name"
						id="newpassword2" placeholder="请重新输入新的密码">
				</div>
			</div>
		</div>
		<!-- /.box-body -->
		<div class="box-footer">
			<button type="button" class="btn btn-default btn-cancel">Cancel</button>
			<button type="button" class="btn btn-info pull-right btn-save">Save</button>
		</div>
		<!-- /.box-footer -->
	</form>
</div>
<script type="text/javascript"
	src="bower_components/ztree/jquery.ztree.all.min.js"></script>
<script type="text/javascript">
	$(function() {
		//异步加载菜单信息,初始化页面菜单
		$(".box-footer").on("click", ".btn-save", doSaveOrUpdate).on("click",
				".btn-cancel", doCancel);
		console.log("pa:"+parames)
	});
	
	function doCancel() {
		var url = "user/doUserListUI.do";
		$("#mainContentId").load(url, function() {
			$("#mainContentId").removeData();
		});
	}
	
	$(function(){
		console.log(getQueryString("username"));
		$("#username").val(getQueryString("username"))
		function getQueryString(name) {
		    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
		    var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
		    var r = window.location.search.substr(1).match(reg);
		    var q = window.location.pathname.substr(1).match(reg_rewrite);
		    if(r != null){
		        return unescape(r[2]);
		    }else if(q != null){
		        return unescape(q[2]);
		    }else{
		        return null;
		    }
		}
	})

	function doSaveOrUpdate() {
		var params={
				username:$("#username").val(),
				orip:$("#oripassword").val(),
				newp1:$("#newpassword1").val(),
				newp2:$("#newpassword2").val()
		}
		console.log("up:",params);
		var url="pw/updatePassw.do";
		$.post(url,params,function(result){
			if(result.state==1){
				 alert(result.message);
				 doCancel();
			 }else{
				alert(result.message);
			 }
		})
	}
	
</script>







